import request from '@/config/axios'

// ERP 采购单项 VO
export interface PurPurchaseOrderItemVO {
  id: number // 编号
  purchaseOrderId: string // 采购单编号-提交供应商采购单编号
  productId: number // 产品编号
  productName: String // 产品编号
  productUnit: number // 产品单位
  productStandards: number // 产品规格
  productPrice: number // 产品单价
  count: number // 数量
  totalPrice: number // 总价
  remark: string // 备注
}

// ERP 采购单项 API
export const PurPurchaseOrderItemApi = {
  // 查询ERP 采购单项分页
  getPurPurchaseOrderItemPage: async (params: any) => {
    return await request.get({ url: `/erp/pur-purchase-order-item/page`, params })
  },

  // 查询ERP 采购单项详情
  getPurPurchaseOrderItem: async (id: number) => {
    return await request.get({ url: `/erp/pur-purchase-order-item/get?id=` + id })
  },

  // 新增ERP 采购单项
  createPurPurchaseOrderItem: async (data: PurPurchaseOrderItemVO) => {
    return await request.post({ url: `/erp/pur-purchase-order-item/create`, data })
  },

  // 修改ERP 采购单项
  updatePurPurchaseOrderItem: async (data: PurPurchaseOrderItemVO) => {
    return await request.put({ url: `/erp/pur-purchase-order-item/update`, data })
  },

  // 删除ERP 采购单项
  deletePurPurchaseOrderItem: async (id: number) => {
    return await request.delete({ url: `/erp/pur-purchase-order-item/delete?id=` + id })
  },

  // 导出ERP 采购单项 Excel
  exportPurPurchaseOrderItem: async (params) => {
    return await request.download({ url: `/erp/pur-purchase-order-item/export-excel`, params })
  },
}
